package resource.pojo;

public class BuyingDocument {

	private String id;
	private String document_id;
	private String name;
	private int amount;
	private String unit;
	private float price;
	private float total;
	private boolean select;
	private String company;
	private float vat;
	private int flagEdit;
	
	public BuyingDocument(){
		
	}
	
	public BuyingDocument(String id, String doc, String name,String company,int amount,
			String unit, float price,float vat,float tl){
		this.id = id;
		this.document_id= doc;
		this.name = name;
		this.company = company;
		this.amount = amount;
		this.unit = unit;
		this.price = price;
		this.vat = vat;
		this.total = tl;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public String getId() {
		return id;
	}

	public void setDocument_id(String document_id) {
		this.document_id = document_id;
	}

	public String getDocument_id() {
		return document_id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public int getAmount() {
		return amount;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getUnit() {
		return unit;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public float getPrice() {
		if(getFlagEdit()==2){
			price  = Math.round(getVat()/1.1);
		}
		return price;
	}

	public void setTotal(float total) {
		this.total = total;
	}

	public void setVat(float vat) {
		this.vat = vat;
	}

	public float getVat() {
		if(getFlagEdit()==1){
			vat= Math.round((getPrice()*1.1));
		}
		return vat;
	}
	
	public float getTotal() {
		return Math.round(getVat()*getAmount());
	}

	public void setSelect(boolean select) {
		this.select = select;
	}

	public boolean isSelect() {
		return select;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getCompany() {
		return company;
	}

	public void setFlagEdit(int flagEdit) {
		this.flagEdit = flagEdit;
	}

	public int getFlagEdit() {
		return flagEdit;
	}
	
	public String toString(){
		return name+" ("+price+" x "+amount+" + "+vat+")";
	}

}
